<?php require_once('connect.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_connect, $connect);
$query_theloai = "SELECT machuyenmuc, tenchuyenmuc FROM chuyenmuc ORDER BY machuyenmuc ASC";
$theloai = mysql_query($query_theloai, $connect) or die(mysql_error());
$row_theloai = mysql_fetch_assoc($theloai);
$totalRows_theloai = mysql_num_rows($theloai);

mysql_select_db($database_connect, $connect);
$query_tintrongloai = "SELECT * FROM baiviet WHERE machuyenmuc = 4 ORDER BY ngayviet DESC";
$tintrongloai = mysql_query($query_tintrongloai, $connect) or die(mysql_error());
$row_tintrongloai = mysql_fetch_assoc($tintrongloai);
$totalRows_tintrongloai = mysql_num_rows($tintrongloai);

$maxRows_bmoits = 3;
$pageNum_bmoits = 0;
if (isset($_GET['pageNum_bmoits'])) {
  $pageNum_bmoits = $_GET['pageNum_bmoits'];
}
$startRow_bmoits = $pageNum_bmoits * $maxRows_bmoits;

mysql_select_db($database_connect, $connect);
$query_bmoits = "SELECT * FROM baiviet WHERE machuyenmuc = 4 ORDER BY ngayviet DESC";
$query_limit_bmoits = sprintf("%s LIMIT %d, %d", $query_bmoits, $startRow_bmoits, $maxRows_bmoits);
$bmoits = mysql_query($query_limit_bmoits, $connect) or die(mysql_error());
$row_bmoits = mysql_fetch_assoc($bmoits);

if (isset($_GET['totalRows_bmoits'])) {
  $totalRows_bmoits = $_GET['totalRows_bmoits'];
} else {
  $all_bmoits = mysql_query($query_bmoits);
  $totalRows_bmoits = mysql_num_rows($all_bmoits);
}
$totalPages_bmoits = ceil($totalRows_bmoits/$maxRows_bmoits)-1;

$maxRows_bmhoro = 3;
$pageNum_bmhoro = 0;
if (isset($_GET['pageNum_bmhoro'])) {
  $pageNum_bmhoro = $_GET['pageNum_bmhoro'];
}
$startRow_bmhoro = $pageNum_bmhoro * $maxRows_bmhoro;

mysql_select_db($database_connect, $connect);
$query_bmhoro = "SELECT * FROM baiviet WHERE machuyenmuc = 1 ORDER BY ngayviet DESC";
$query_limit_bmhoro = sprintf("%s LIMIT %d, %d", $query_bmhoro, $startRow_bmhoro, $maxRows_bmhoro);
$bmhoro = mysql_query($query_limit_bmhoro, $connect) or die(mysql_error());
$row_bmhoro = mysql_fetch_assoc($bmhoro);

if (isset($_GET['totalRows_bmhoro'])) {
  $totalRows_bmhoro = $_GET['totalRows_bmhoro'];
} else {
  $all_bmhoro = mysql_query($query_bmhoro);
  $totalRows_bmhoro = mysql_num_rows($all_bmhoro);
}
$totalPages_bmhoro = ceil($totalRows_bmhoro/$maxRows_bmhoro)-1;

$maxRows_bmtn = 3;
$pageNum_bmtn = 0;
if (isset($_GET['pageNum_bmtn'])) {
  $pageNum_bmtn = $_GET['pageNum_bmtn'];
}
$startRow_bmtn = $pageNum_bmtn * $maxRows_bmtn;

mysql_select_db($database_connect, $connect);
$query_bmtn = "SELECT * FROM baiviet WHERE machuyenmuc=2 ORDER BY ngayviet DESC";
$query_limit_bmtn = sprintf("%s LIMIT %d, %d", $query_bmtn, $startRow_bmtn, $maxRows_bmtn);
$bmtn = mysql_query($query_limit_bmtn, $connect) or die(mysql_error());
$row_bmtn = mysql_fetch_assoc($bmtn);

if (isset($_GET['totalRows_bmtn'])) {
  $totalRows_bmtn = $_GET['totalRows_bmtn'];
} else {
  $all_bmtn = mysql_query($query_bmtn);
  $totalRows_bmtn = mysql_num_rows($all_bmtn);
}
$totalPages_bmtn = ceil($totalRows_bmtn/$maxRows_bmtn)-1;

$maxRows_bmfunny = 3;
$pageNum_bmfunny = 0;
if (isset($_GET['pageNum_bmfunny'])) {
  $pageNum_bmfunny = $_GET['pageNum_bmfunny'];
}
$startRow_bmfunny = $pageNum_bmfunny * $maxRows_bmfunny;

mysql_select_db($database_connect, $connect);
$query_bmfunny = "SELECT * FROM baiviet WHERE machuyenmuc=3 ORDER BY ngayviet DESC";
$query_limit_bmfunny = sprintf("%s LIMIT %d, %d", $query_bmfunny, $startRow_bmfunny, $maxRows_bmfunny);
$bmfunny = mysql_query($query_limit_bmfunny, $connect) or die(mysql_error());
$row_bmfunny = mysql_fetch_assoc($bmfunny);

if (isset($_GET['totalRows_bmfunny'])) {
  $totalRows_bmfunny = $_GET['totalRows_bmfunny'];
} else {
  $all_bmfunny = mysql_query($query_bmfunny);
  $totalRows_bmfunny = mysql_num_rows($all_bmfunny);
}
$totalPages_bmfunny = ceil($totalRows_bmfunny/$maxRows_bmfunny)-1;

mysql_select_db($database_connect, $connect);
$query_tinmoi = "SELECT * FROM baiviet ORDER BY ngayviet DESC";
$tinmoi = mysql_query($query_tinmoi, $connect) or die(mysql_error());
$row_tinmoi = mysql_fetch_assoc($tinmoi);
$totalRows_tinmoi = mysql_num_rows($tinmoi);
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="text.css" />
<link rel="stylesheet" href="styles.css" />
    <link rel="stylesheet" href="960.css" />
	

	<link rel="stylesheet" href="default.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="pascal.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="orman.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
     <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
     <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
   <script type="text/javascript" src="jq/jquery-1.6.1.min.js"></script>
    <script type="text/javascript" src="jq/jquery.nivo.slider.pack.js"></script>
    <script type="text/javascript">
    $(window).load(function() {
        $('#slider').nivoSlider();
    });
    </script>

<title>HoroscopeVn</title>

<style type="text/css">
<!--
.style1 {
	color: #99CC99
}
.style2 {color: #56C846}
.style3 {
	color: #669933;
	text-decoration: underline;
}
-->
</style>
</head>

<body>
<div class="white">
<div class="center">
<div class="clear"></div>
<div class="sliderr1">
<div class="sliderr">


        <div class="slider-wrapper theme-default">
            <div class="ribbon"></div>
            <div id="slider" class="nivoSlider">
                <img src="img/banner01.jpg" alt="" />
                <img src="img/banner02.jpg" alt="" />
                <img src="img/banner03.jpg" alt="" />
                <img src="img/banner05.jpg" alt="" />
				<img src="img/banner04.jpg" alt="" />
          </div>
            
       

    </div></div><div class="clear"></div>
</div>


<div class="menu">
<ul class="nav">
<li ><a href="index.php"><br />
TRANG CHỦ </a></li>
<?php do { ?>
  <li><a href="tintheoloai.php?machuyenmuc=<?php echo $row_theloai['machuyenmuc']; ?>"><br />
    <?php echo $row_theloai['tenchuyenmuc']; ?></a></li>
  <?php } while ($row_theloai = mysql_fetch_assoc($theloai)); ?>
<li ><a href="#"><br />
LIÊN HỆ </a></li>
</ul>
</div>
<div class="welcome">
<div class="visit">
<table width="600" border="0">
  <tr>
    <td width="207">
    <img src="img/<?php echo $row_tinmoi['anh']; ?>" width="190" height="180"> </td>
    <td width="383" valign="top"><table width="380" border="0">
      <tr valign="top">
      <td valign="top">
        <p><a href="chitiettin.php?mabaiviet=<?php echo $row_tinmoi['mabaiviet']; ?>" class="titletintheoloai">
		<?php echo $row_tinmoi['tenbaiviet']; ?></a> </p>
      <p class="text6">
          <?php echo $row_tinmoi['doantrich']; ?> </p>     </td>
      </tr>
    </table></td>
  </tr>
</table>
</div>
<div class="visitor"></div>
<img src="img/08.png" alt="img" />
</div><div class="clear"></div>

<div class="group">
<div class="experience2">
<p class="text1"><img src="img/09.png" alt="img" />Horoscope</p>
<p class="text5">Tử vi, tính cách theo cung hoàng đạo </p>
<p>
<table width="420" border=0px>
  <tr>
  <td> <p><img src="img/<?php echo $row_bmhoro['anh']; ?>" width="140" height="140"></p>    </td>
</tr>
  <?php do { ?>
    <tr>
          <td class="text3"><p><a href="chitiettin.php?mabaiviet=<?php echo $row_bmhoro['mabaiviet']; ?>"><?php echo $row_bmhoro['tenbaiviet']; ?></a></p></td>
    </tr>
    <?php } while ($row_bmhoro = mysql_fetch_assoc($bmhoro)); ?>
</table>
<p class="text31"><a  href="tintheoloai.php?machuyenmuc=1">Xem thêm</a>&nbsp;<img src="img/13.png" alt="img" /></p>
</div>
<div class="experience1"><img src="img/12.png" alt="img" /></div>

<div class="managment">
  <p class="text1"><img src="img/10.png" alt="img" />Trắc nghiệm </p>
  <p class="text5">Trắc nghiệm tâm lý </p><p>
  <table width="420" border="0">
    <tr>
      <td><img src="img/<?php echo $row_bmtn['anh']; ?>" width="140" height="140"></td>
    </tr>
    <?php do { ?>
      <tr>
          <td class="text3"><a href="chitiettin.php?mabaiviet=<?php echo $row_bmtn['mabaiviet']; ?>" class="text3"><?php echo $row_bmtn['tenbaiviet']; ?></a></td>
      </tr>
      <?php } while ($row_bmtn = mysql_fetch_assoc($bmtn)); ?>
  </table> 
  <p class="text31"><a href="tintheoloai.php?machuyenmuc=2">Xem thêm</a>&nbsp;<img src="img/13.png" alt="img" /></div>
  </p><img src="img/08.png" alt="img" />
  
<div class="research">
  <p class="text1"><img src="img/11.png" alt="img" />Funny</p>
  <p class="text5">Hihi cùng Horoscope </p>
  <p>
  <table width="420" border="0">
  <tr>
    <td><img src="img/<?php echo $row_bmfunny['anh']; ?>" width="140" height="140"></td>
  </tr>
  <?php do { ?>
    <tr>
      <td class="text3"><a href="chitiettin.php?mabaiviet=<?php echo $row_bmfunny['mabaiviet']; ?>" class="text3"><?php echo $row_bmfunny['tenbaiviet']; ?></a></td>
    </tr>
    <?php } while ($row_bmfunny = mysql_fetch_assoc($bmfunny)); ?>
</table>

  <p class="text31"><a href="tintheoloai.php?machuyenmuc=3">Xem thêm</a>&nbsp;<img src="img/13.png" alt="img" /> </p> 
</div>
<div class="experience1"><img src="img/12.png" alt="img" /></div>



<div class="tamli"> 
 <p class="text1"><img src="img/icon.jpg" alt="img" width="45" height="43" /> Tâm sự</p>
  <p class="text5">Tâm sự, tư vấn </p>
  <p>  
  <table width="420" border=0px>
  <tr>
    <td><img src="img/<?php echo $row_bmoits['anh']; ?>" width="140" height="140"></td>
  </tr>
  <?php do { ?>
    <tr>
        <td class="text3"><p><a href="chitiettin.php?mabaiviet=<?php echo $row_bmoits['mabaiviet']; ?>" class="text3"><?php echo $row_bmoits['tenbaiviet']; ?></a></p></td>
    </tr>
    <?php } while ($row_bmoits = mysql_fetch_assoc($bmoits)); ?>
</table>

</p>
  <p class="text31"><a href="tintheoloai.php?machuyenmuc=4">Xem thêm</a>&nbsp;<img src="img/13.png" alt="img" /></p></div>
<img src="img/08.png" alt="img" /></div>

<div class="center">
<div class="solutions">
  <p class="text4">Comments</p>
  <ul class="ulul">
<li><a target="_blank" href="">At vero eos et accusamus et iusto odio </a></li>
<li><a target="_blank" href="">Signissimos ducimus qui blanditiis Prae</a></li>
<li><a target="_blank" href="">sentium voluptatum deleniti atque Cor</a></li>
<li><a target="_blank" href="">rupti quos dolores et quas molestias </a></li>
<li><a target="_blank" href="">Excepturi sint occaecati cupiditate non</a> </li>
<li><a target="_blank" href="">Provident similique sunt in culpa qui</a> </li>
<li><a target="_blank" href="">Officia deserunt mollitia animiid est</a> </li>
<li><a target="_blank" href="">Aborum et dolorum fuga et harum</a> </li>
</ul>
</div>
<div class="solut1"><img src="img/15.png" alt="img" /></div>
<div class="successful">
  <p class="text4">About Horoscope  </p>
  <div class="imgread"><img src="img/01.jpg" alt="img" width="272" height="224" />
    <p class="text3"><a target="_blank" href="">Xem thêm</a>&nbsp;<img src="img/13.png" alt="img" /></p></div>
<div class="sed"><p class="text5">Sed vero eos et accusamus et iusto odio dignissimos ducimus qui.      </p>
<p class="text6"> At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum esi deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate. </p>
</div>
</div>

<div class="v"></div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<div id="divAdRight" style="DISPLAY: none; POSITION: absolute; TOP: 0px"> 
<a href="#"><img src="img/bannerfpt.jpg" width="125" /></a>
</div> 
<div id="divAdLeft" style="DISPLAY: none; POSITION: absolute; TOP: 0px"> 
<a href="#"><img src="img/bannerfpt.jpg" width="125" /></a>       
</div> 
<script> 
    function FloatTopDiv() 
    { 
        startLX = ((document.body.clientWidth -MainContentW)/2)-LeftBannerW-LeftAdjust , startLY = TopAdjust+80; 
        startRX = ((document.body.clientWidth -MainContentW)/2)+MainContentW+RightAdjust , startRY = TopAdjust+80; 
        var d = document; 
        function ml(id) 
        { 
            var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; 
            el.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; 
            el.x = startRX; 
            el.y = startRY; 
            return el; 
        } 
        function m2(id) 
        { 
            var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id]; 
            e2.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';}; 
            e2.x = startLX; 
            e2.y = startLY; 
            return e2; 
        } 
        window.stayTopLeft=function() 
        { 
            if (document.documentElement && document.documentElement.scrollTop) 
                var pY =  document.documentElement.scrollTop; 
            else if (document.body) 
                var pY =  document.body.scrollTop; 
            if (document.body.scrollTop > 30){startLY = 3;startRY = 3;} else {startLY = TopAdjust;startRY = TopAdjust;}; 
            ftlObj.y += (pY+startRY-ftlObj.y)/16; 
            ftlObj.sP(ftlObj.x, ftlObj.y); 
            ftlObj2.y += (pY+startLY-ftlObj2.y)/16; 
            ftlObj2.sP(ftlObj2.x, ftlObj2.y); 
            setTimeout("stayTopLeft()", 1); 
        } 
        ftlObj = ml("divAdRight"); 
        //stayTopLeft(); 
        ftlObj2 = m2("divAdLeft"); 
        stayTopLeft(); 
    } 
    function ShowAdDiv() 
    { 
        var objAdDivRight = document.getElementById("divAdRight"); 
        var objAdDivLeft = document.getElementById("divAdLeft");        
        if (document.body.clientWidth < 1000) 
        { 
            objAdDivRight.style.display = "none"; 
            objAdDivLeft.style.display = "none"; 
        } 
        else 
        { 
            objAdDivRight.style.display = "block"; 
            objAdDivLeft.style.display = "block"; 
            FloatTopDiv(); 
        } 
    }  
</script> 
<script> 
document.write("<script type='text/javascript' language='javascript'>MainContentW = 1000;LeftBannerW = 125;RightBannerW = 125;LeftAdjust = 5;RightAdjust = 5;TopAdjust = 10;ShowAdDiv();window.onresize=ShowAdDiv;;<\/script>"); 
</script>

</body>
</html>
<?php
mysql_free_result($theloai);

mysql_free_result($tintrongloai);

mysql_free_result($bmoits);

mysql_free_result($bmhoro);

mysql_free_result($bmtn);

mysql_free_result($bmfunny);

mysql_free_result($tinmoi);
?>
